<?php
namespace app\admin\controller;

use think\Db;

class Feedback extends Backend
{
    /**
     * @var string
     * 快速搜索的时候查询的字段，支持逗号分隔的字符串或数组
     */
    protected $searchFields = 'mobile,content';

    public function initialize()
    {
        parent::initialize();
    }

    public function index()
    {
        if($this->request->isAjax()){
            list($where, $sort, $order, $page, $offset, $limit) = $this->buildSearchParams($this->searchFields);
            $rows = Db::name($this->tableName)->where($where)->order($sort, $order)->paginate([
                'list_rows' => $limit,
                'page' => $page,
            ]);
            $data = [
                'total' => $rows->total(),
                'rows' => $rows->items(),
            ];
            return json($data);
        }
        return $this->fetch();
    }



}
